import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.testng.AbstractTestNGSpringContextTests;
import org.springframework.beans.factory.annotation.Autowired;
import org.testng.annotations.Test;
import ru.ksu.ktk.diploma.sdi.SchemaIntegrator;

import java.io.IOException;
import java.io.InputStream;

/**
 * @author NZhiltsov Time: 16:06:54
 */
@ContextConfiguration(locations = {
		"classpath:META-INF/spring/mapping-beans.xml",
		"classpath:test-dao-beans.xml",
		"classpath:test-properties-beans.xml",
		"classpath:META-INF/spring/analyzer-beans.xml"})
public class SchemaIntegratorTestCase extends AbstractTestNGSpringContextTests {
	@Autowired
	SchemaIntegrator schemaIntegrator;

	@Test
	public void testGenerateMapping() throws IOException {
		InputStream dataSourceStream = null;
		try {
			dataSourceStream = this.getClass().getResourceAsStream(
					"/test_data_source.xml");
			// "http://localhost:8080/exist/rest/db/mom/data/emku/sources/EMKU_50_schema.owl"
			schemaIntegrator.generateMapping(dataSourceStream);
		} finally {
			if (dataSourceStream != null)
				dataSourceStream.close();
		}
	}
}
